from ronglian_sms_sdk import SmsSDK
import json
from django_redis import get_redis_connection


accId = '8aaf07087a331dc7017ae5df387d36ac'
accToken = '2fda1fc5b4fb4c86b187b8788f9e4dac'
appId = '8aaf07087a331dc7017ae5df397f36b3'


def send_message(mobile, code, time):
    sdk = SmsSDK(accId, accToken, appId)
    tid = '1'
    mobile = '13239516191'
    datas = (code, time)
    resp = sdk.sendMessage(tid, mobile, datas)
    result = json.loads(resp)
    if result['statusCode'] == '000000':
        return True
    return False


def get_redis():
    conn = get_redis_connection()
    return conn